﻿using ServiceStack.Common;
using ServiceStack.ServiceInterface;
using System.Collections.Generic;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ServiceStack.ServiceHost;
using ServiceStack.ServiceInterface.ServiceModel;
using g42.Dto;
using g42.Repos;

namespace g42.Services
{

  public class PersonService : Service
  {
    public PersonRepository Repository { get; set; }  //Injected by IOC

    public object Get(PersonList request)
    {
      // return request.Ids.IsEmpty() ? Repository.GetAll() : Repository.GetByIds(request.Ids);
      return Repository.Get(request);
    }

    public object Post(Person aPerson)
    {
      return Repository.Store(aPerson);
    }

    public object Put(Person aPerson)
    {
      return Repository.Store(aPerson);
    }

    public void Delete(PersonList request)
    {
      Repository.DeleteByIds(request.Ids);
    }
  }
}
